const prefix = '/api';
const suffix = '.do';

const urlMap = {
   'dev': {
      '登录': '/sign',
      '退出登录': '/signout',
      '注册': '/signup',
      '发送手机验证码': '/sendSmsCode',
      '实名认证': '/doIdCardAuth',
      '用户详情': '/enterpriseUserDetail',
      '忘记密码':'/resetLoginPw',
      '验证码登录':'/signByVerifyCode',
      '热门监控分类列表':'/mainTest02CateList',
      '热门监测列表':'/mainTestItem02List',
      'banner':'/bannerList',
      '我要检测列表':'/mainTestItem01List',
      '立即预约':'/createTestBook',
      '检测定位':'/createTestDesignate',
      '项目列表(选择框使用)':'/testItemListForOption',
      '标准文献列表':'/testStandardList',
      '标准文献详情':'/testStandardDetail',
      '修改基本信息':'/updateEnterpriseUser',
      '修改密码(通过老密码)':'/resetLoginPwByOldPw',
      '更新头像':'/updateEnterpriseUserImage',
      '取消收藏项目':'/cancelFavoriteItem',
      '取消所有收藏项目':'/cancelAllFavoriteItem',
      '收藏列表':'/enterpriseUserFavoriteList',


      '项目详情':'/vulnerabilityProjectDetail',
      '项目详情(未登录)':'/vulnerabilityProjectDetailNotLogin',
   }
};

export const urlService = (type: string, key: string) => {
   const url = urlMap[type][key];
   if (url) {
      return prefix + urlMap[type][key] + suffix;
   } else {
      throw Error(`fail to find url: ${key}`);
   }
};

